//
//  ZQQViewController.m
//  ZQQBannerView
//
//  Created by wushengdubai on 07/15/2017.
//  Copyright (c) 2017 wushengdubai. All rights reserved.
//

#import "ZQQViewController.h"
#import "ZQQSegmentBarVC.h"
#import "ZQQBannerViewController.h"

@interface ZQQViewController ()

@property (nonatomic, strong) ZQQSegmentBarVC *segmentBarVC;

@end

@implementation ZQQViewController
- (ZQQSegmentBarVC *)segmentBarVC {
    if (!_segmentBarVC) {
        ZQQSegmentBarVC *vc = [[ZQQSegmentBarVC alloc] init];
        [self addChildViewController:vc];
        _segmentBarVC = vc;
    }
    return _segmentBarVC;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.automaticallyAdjustsScrollViewInsets = NO;
    [self test1];
}

- (void)test1 {
    self.segmentBarVC.view.frame = self.view.bounds;
    [self.view addSubview:self.segmentBarVC.view];
    
    NSArray *items = @[@"专辑", @"声音", @"下载中"];
    
    // 添加几个自控制器
    // 在contentView, 展示子控制器的视图内容
    ZQQBannerViewController *vc1 = [ZQQBannerViewController new];
    
    UIViewController *vc2 = [UIViewController new];
    vc2.view.backgroundColor = [UIColor greenColor];
    
    UIViewController *vc3 = [UIViewController new];
    vc3.view.backgroundColor = [UIColor yellowColor];
    
    
    [self.segmentBarVC setUpWithItems:items childVCs:@[vc1, vc2, vc3]];
}

@end
